/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * Entidade Cliente
 */
@Entity
@Table(name = "cliente", catalog = "agenciadeviagem", schema = "")
@NamedQueries({
    @NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c"),
    @NamedQuery(name = "Cliente.findByCpf", query = "SELECT c FROM Cliente c WHERE c.cpf = :cpf"),
    @NamedQuery(name = "Cliente.findByNome", query = "SELECT c FROM Cliente c WHERE c.nome = :nome"),
    @NamedQuery(name = "Cliente.findByLogin", query = "SELECT c FROM Cliente c WHERE c.login = :login"),
    @NamedQuery(name = "Cliente.findBySenha", query = "SELECT c FROM Cliente c WHERE c.senha = :senha")

})
public class Cliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cpf", nullable = false)
    private Integer cpf;
    @Basic(optional = false)
    @Column(name = "nome", nullable = false, length = 20)
    private String nome;
    @Column(name = "login", length = 20)
    private String login;
    @Column(name = "senha", length = 20)
    private String senha;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "clientecpf")
    private Collection<Passagem> passagemCollection;

    /**
     *
     */
    public Cliente() {
    }

    /**
     *
     * @param cpf
     */
    public Cliente(Integer cpf) {
        this.cpf = cpf;
    }

    /**
     *
     * @param cpf
     * @param nome
     */
    public Cliente(Integer cpf, String nome) {
        this.cpf = cpf;
        this.nome = nome;
    }

    /**
     *
     * @return Integer
     */
    public Integer getCpf() {
        return cpf;
    }

    /**
     *
     * @param cpf
     */
    public void setCpf(Integer cpf) {
        this.cpf = cpf;
    }

    /**
     *
     * @return String
     */
    public String getNome() {
        return nome;
    }

    /**
     *
     * @param nome
     */
    public void setNome(String nome) {
        this.nome = nome;
    }

    /**
     *
     * @return String
     */
    public String getLogin() {
        return login;
    }

    /**
     *
     * @param login
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     *
     * @return String
     */
    public String getSenha() {
        return senha;
    }

    /**
     *
     * @param senha
     */
    public void setSenha(String senha) {
        this.senha = senha;
    }

    /**
     *
     * @return Collection
     */
    public Collection<Passagem> getPassagemCollection() {
        return passagemCollection;
    }

    /**
     *
     * @param passagemCollection
     */
    public void setPassagemCollection(Collection<Passagem> passagemCollection) {
        this.passagemCollection = passagemCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cpf != null ? cpf.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.cpf == null && other.cpf != null) || (this.cpf != null && !this.cpf.equals(other.cpf))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Cliente[cpf=" + cpf + "]";
    }

}
